<template>
    <div>
        <echarts-form 
            v-for="(item,i) in echartsData" 
            :key="i"
            :option="item"
        ></echarts-form>
    </div>
</template>
<script>
import EchartsForm from '@/components/echartsForm';
import echartsData from '@/config/echartsData';
import api from '@/api';
export default {
   components:{
       EchartsForm
   },
   async created(){
       for(let i = 0;i<this.echartsData.length;i++){
           let res = await api.getEchartsData();
           this.echartsData[i].xAxis.data = res.data.map(item => item.time);
           this.echartsData[i].series[0].data = res.data.map(item => item.num);
       }
    },
   data(){
       return {
           echartsData
       }
   }
}
</script>

<style lang="scss" scoped>
    .echartsWrapper{
        width:300px;
        height:200px;
        border:1px solid gray;
    }
</style>
